package com.falm.maker.meta;

import cn.hutool.core.io.resource.ResourceUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import lombok.Synchronized;

/**
 * @author Administrator
 */
public class MetaManager {

    //使用单例模式初始化对象
    private static volatile Meta meta;

    public static Meta getMetaObject(){
        if(meta == null){
            synchronized (MetaManager.class) {
                if(meta == null){
                    meta = initMetaInfo();
                }
            }
        }
        return meta;
    }


    private static Meta initMetaInfo() {
        String metaInfoJson = ResourceUtil.readUtf8Str("meta.json");
        Meta meta = JSONUtil.toBean(metaInfoJson, Meta.class);
        return meta;
    }
}
